﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Xml.Xsl;
using TanashCMS.Business;
using System.IO;
public partial class atom : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Clear();
        Response.ContentType = "application/atom+xml";

        Uri uri = Request.Url;

        // find the hostname
        string[] domain = uri.Host.Split('.');
        string hostname = uri.Host;
        if (hostname.Substring(0, 4) == "www.")
            hostname = hostname.Substring(4);

        TanashWebsite mWebsite = TanashWebsite.GetByHostName(hostname);

        if (mWebsite != null)
        {

            XslCompiledTransform xTrans = new XslCompiledTransform();
            XsltArgumentList args = new XsltArgumentList();

            xTrans.Load(Server.MapPath("~/xsl/atom.xsl"));
            xTrans.Transform(Server.MapPath(mWebsite.XmlPath), args, Response.Output);
        }
    }

    protected override void Render(HtmlTextWriter writer)
    {
        //base.Render(writer);
    }
}
